package com.example.demo.dao;

import com.example.demo.model.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lishuo
 * Date: 2023-11-27
 * Time: 9:55
 */
@Mapper
public interface UserMapper {
    @Insert("insert into userinfo(username,password,email) values(#{username},#{password},#{email})")
    int reg(UserInfo userInfo);

    @Select("select * from userinfo where username=#{username}")
    UserInfo getUserByName(@Param("username") String username);

    @Select("select * from userinfo where id=#{id}")
    UserInfo getUserById(@Param("id") Integer id);
}
